﻿using Coding4Fun.Lockscreen.Core.Models;
using Microsoft.WindowsAzure.MobileServices;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace Coding4Fun.Lockscreen.Mobile.Data
{
    public class DataEngine
    {
        async public Task<List<Category>> GetCategoryList()
        {
            IMobileServiceTable<Category> table = App.MobileService.GetTable<Category>();
            List<Category> data = await table.ToListAsync();

            return data;
        }

        async public Task<List<Image>> GetImagesByCategoryId(int categoryId)
        {
            IMobileServiceTable<Image> table = App.MobileService.GetTable<Image>();
            List<Image> data = await table.Where(x => x.CategoryID == categoryId).ToListAsync();

            return data;
        }
    }
}
